home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3
/
SCSetScanEnt.z
/
SCSetScanEnt
Wrap
Text File
|
1998-10-30
|
6KB
|
133 lines
SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333))))
NNNNAAAAMMMMEEEE
SCSetScanEnt, SCGetScanEnt, SCEndScanEnt - Getting information about
installed scanners
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
####iiiinnnncccclllluuuuddddeeee <<<<ssssccccaaaannnnnnnneeeerrrr....hhhh>>>>
FFFFIIIILLLLEEEE ****SSSSCCCCSSSSeeeettttSSSSccccaaaannnnEEEEnnnntttt((((vvvvooooiiiidddd))));;;;
SSSSCCCCAAAANNNNEEEENNNNTTTT ****SSSSCCCCGGGGeeeettttSSSSccccaaaannnnEEEEnnnntttt((((FFFFIIIILLLLEEEE ****ffffpppp))));;;;
iiiinnnntttt SSSSCCCCEEEEnnnnddddSSSSccccaaaannnnEEEEnnnntttt((((FFFFIIIILLLLEEEE ****ffffpppp))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
These routines provide a programmatic interface for reading the file
/_u_s_r/_l_i_b/_s_c_a_n/_s_c_a_n_n_e_r_s, which contains a one line entry specifying the
name, driver, device, and options program for each scanner installed on
the system.
_S_C_S_e_t_S_c_a_n_E_n_t opens /_u_s_r/_l_i_b/_s_c_a_n/_s_c_a_n_n_e_r_s, returning a pointer to a FFFFIIIILLLLEEEE
structure. _S_C_G_e_t_S_c_a_n_E_n_t parses the next line of _f_p into a _S_C_A_N_E_N_T
structure, which is declared in <_s_c_a_n_n_e_r._h> as follows:
typedef struct tag_scanent {
char *name;
char *driver;
char *device;
char *options;
} SCANENT;
In this structure, _n_a_m_e is the name of the scanner assigned by the system
administrator using _s_c_a_n_n_e_r_s(1M) at the time the scanner was installed.
_d_r_i_v_e_r is the name of the scanner driver for this scanner. _d_e_v_i_c_e is the
device parameter passed to the driver, and _o_p_t_i_o_n_s is the scanner
specific options program for this scanner.
From a scanner application's point of view, _n_a_m_e is the only significant
field. _n_a_m_e is the string to be passed to _S_C_O_p_e_n(3) to open a scanner.
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
_S_C_S_e_t_S_c_a_n_E_n_t returns a pointer to a _F_I_L_E structure if successful, or NULL
if an error occurs.
_S_C_G_e_t_S_c_a_n_E_n_t returns a pointer to a _S_C_A_N_E_N_T structure, or NULL if there
are no more scanners left to parse in /_u_s_r/_l_i_b/_s_c_a_n/_s_c_a_n_n_e_r_s.
_S_C_E_n_d_S_c_a_n_E_n_t returns 0 if successful, -1 if error.
PPPPaaaaggggeeee 1111
SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo SSSSCCCCGGGGEEEETTTTSSSSCCCCAAAANNNNEEEENNNNTTTT((((3333))))
In the event of an error, _S_C_S_e_t_S_c_a_n_E_n_t and _S_C_E_n_d_S_c_a_n_E_n_t will set _S_C_e_r_r_n_o
to indicate the cause of the error.
EEEEXXXXEEEECCCCUUUUTTTTIIIIOOOONNNN EEEERRRRRRRROOOORRRR CCCCOOOODDDDEEEESSSS
SCENOSCANNERS No scanners are installed
In addition, these functions may fail as the result of a failed system
call, in which case _S_C_e_r_r_n_o will be set to a value from
/_u_s_r/_i_n_c_l_u_d_e/_s_y_s/_e_r_r_n_o._h.
EEEEXXXXAAAAMMMMPPPPLLLLEEEE
The following example prints out the names of all installed scanners. A
scanner application can use these functions to present a list of
installed scanners to the user, so the user can select which one to open.
#include <stdio.h>
#include <scanner.h>
int
main(void)
{
FILE *fp;
SCANENT *ent;
if ((fp = SCSetScanEnt()) == NULL) {
SCPerror("SCSetScanEnt");
exit(1);
}
printf("Installed scanners:\n");
while ((ent = SCGetScanEnt(fp)) != NULL) {
printf("%s\n", ent->name);
}
SCEndScanEnt(fp);
exit(0);
}
WWWWAAAARRRRNNNNIIIINNNNGGGG
The return value of _S_C_G_e_t_S_c_a_n_E_n_t points to memory owned by _l_i_b_s_c_a_n(3).
The calling program should not modify the memory pointed to by the return
value of _S_C_G_e_t_S_c_a_n_E_n_t, nor should any assumptions be made about its value
after subsequent calls to _S_C_G_e_t_S_c_a_n_E_n_t. Any needed information should be
copied into program memory before calling _S_C_G_e_t_S_c_a_n_E_n_t again.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
_l_i_b_s_c_a_n(3), _S_C_O_p_e_n(3), _s_c_a_n_n_e_r_s(1M).
PPPPaaaaggggeeee 2222